package com.jpro.module.system.convert.tenant;

import com.jpro.module.system.controller.admin.tenant.vo.tenant.TenantSaveReqVO;
import com.jpro.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import com.jpro.module.system.dal.dataobject.tenant.TenantDO;
import com.jprocms.module.cms.api.vo.SiteTenantCreateReqVO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * 租户 Convert
 *
 * @author JPROCMS
 */
@Mapper
public interface TenantConvert {

    TenantConvert INSTANCE = Mappers.getMapper(TenantConvert.class);

    default UserSaveReqVO convert02(TenantSaveReqVO bean) {
        UserSaveReqVO reqVO = new UserSaveReqVO();
        reqVO.setUsername(bean.getUsername());
        reqVO.setPassword(bean.getPassword());
        reqVO.setNickname(bean.getContactName()).setMobile(bean.getContactMobile());
        return reqVO;
    }


    default SiteTenantCreateReqVO convertSiteCreateVO(TenantSaveReqVO bean, String sitePath) {
        SiteTenantCreateReqVO reqVO = new SiteTenantCreateReqVO();
        reqVO.setName(bean.getName());
        reqVO.setSiteDomain(bean.getWebsite());
        reqVO.setSitePath(sitePath);
        return reqVO;
    }

}
